﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;

namespace DNA.Mvc
{
    public class PageNotFoundResult : ActionResult
    {
        public override void ExecuteResult(ControllerContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            string url = UrlHelper.GenerateContentUrl(WebSiteContext.Current.Web == null ? "~/Error/PageNotFound" : "~/" + WebSiteContext.Current.Web.Name + "-Error/PageNotFound", context.HttpContext);
            context.Controller.TempData.Keep();
            context.HttpContext.Response.Redirect(url);
        }
    }

    public class WebsiteNotFoundResult : ActionResult
    {
        public override void ExecuteResult(ControllerContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            string url = UrlHelper.GenerateContentUrl("~/Error/WebSiteNotFound", context.HttpContext);
            context.Controller.TempData.Keep();
            context.HttpContext.Response.Redirect(url);
        }
    }
}
